home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1990 / Sep 90 / MacApp.Tech$ 9⁄21⁄90 / 2011-'Phantom' Handles...-Sep90 < prev    next >
Encoding:
Text File  |  1991-03-06  |  2.6 KB  |  91 lines  |  [TEXT/GEOL]

  1. Item    3426824                         17-Sept-90        16:40PDT
  2.  
  3. From:   AFTERHOURS                      After Hours SW,Richard Wolpert,PRT
  4.  
  5. To:     MACDTS                          Macintosh Developer Tech Supt
  6.         MACAPP.TECH$                    MacApp Technical
  7.  
  8. cc:     AFTERHOURS                      After Hours SW,Richard Wolpert,PRT
  9.  
  10. Sub:    'Phantom' Handles...
  11.  
  12.  
  13.     TO: MAC.DTS, MACAPP.TECH$
  14.     FR: AFTERHOURS
  15.     RE: Extra Handles...
  16.  
  17. "Me and handles, we don't get along..."
  18.  
  19. I am having a problem with an extra 'phantom' handle appearing after I display
  20. a small window with the following code in a DoChoice method of a dialog box:
  21.  
  22. PROCEDURE TMyDialog.DoChoice (origView: TView; itsChoice: INTEGER); OVERRIDE;
  23. VAR
  24.    aPassword   :   Str255;
  25.    attempt :   Str255;
  26.    aWindow :   TWindow;
  27.    aDialog :   TDialogView;
  28.    anEntry :   TEditText;
  29.    continue:   BOOLEAN;
  30.    aDismisser  :   IDType;
  31. BEGIN
  32.    IF origView.fIdentifier = 'pass' THEN BEGIN
  33.  
  34.    continue := FALSE;
  35.    aPassword := gPreferences^^.passWord;
  36.  
  37.    ProgramBreak('before making...');
  38.  
  39.    aWindow := NewTemplateWindow(5010, NIL);
  40.    aDialog := TDialogView(aWindow.FindSubView('DLOG'));
  41.    anEntry := TEditText(aWindow.FindSubView('ntry'));
  42.  
  43.    ProgramBreak('before asking...');
  44.  
  45.    aDismisser := aDialog.PoseModally;
  46.    anEntry.GetText(attempt);
  47.    aWindow.Close;
  48.    aWindow.Free;
  49.  
  50.    ProgramBreak('after freeing...');
  51.  
  52.    IF aDismisser = 'OKHT' THEN BEGIN
  53.  
  54.    IF (attempt = aPassword) THEN
  55.    continue := TRUE;
  56.  
  57.    END;
  58.  
  59.    IF continue THEN BEGIN
  60.  
  61.     { do whatever here... }
  62.  
  63.    END;
  64.  
  65.    END ELSE
  66.    INHERITED DoChoice(origView, itsChoice);
  67. END;
  68.  
  69. After the window is closed and freed, a check in MacsBug with 'ht' shows that
  70. there is an extra relocatable handle created, which I cannot account for.  What
  71. makes this problem even more disturbing for me is that this problem is occuring
  72. in another section of my application, and I cannot trace it down as narrowly as
  73. I have with this occurance.   The characterstics of these 'phantom' handles are
  74. such that I cannot even identify it, because each varies in size over a wide
  75. range from 4 to 100 or so bytes big, or sometimes the total size of relocatable
  76. blocks shrinks, meaning that the handle is negative in size (??? can't be!).
  77.  
  78. The view template resource simply contains a TWindow, a TDialogView, a
  79. TDialogTEView, a TStaticText view, and a TButton.
  80.  
  81. In previous projects, I have never run in any troubles such as these with views
  82. and handles...  If anyone has any clue as to where these handles are coming
  83. from, please link me directly.  Thanks...
  84.  
  85. Despirately frustrated, I remain,
  86.  
  87. Danny Cooley
  88. After Hours Software
  89. ALink: AFTERHOURS
  90.  
  91.